<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="testid">testid DIV</div>

    <div class="testClass">testClass 测试选择器</div>
    <div class="testClass">testClass 测试选择器</div>
    <div class="testClass">testClass 测试选择器</div>


    <p>测试标签选择器</p>
    <p>测试标签选择器</p>
    <p>测试标签选择器</p>

    <script>
        var tclass=document.querySelectorAll('.testClass')
        for(var i=0;i<tclass.length;i++)
        {
            if(i%2==0)
            {
                tclass[i].innerHTML='这是queryselectorall控制的html'+i
            }
        }
        var pall=document.querySelectorAll('p')
        for(var i=0;i<pall.length;i++)
        {
            pall[i].style.color='red'
        }
    </script>
</body>
</html>